<template>
  <div id="app">
    <header class="head">
      <a class="back tl" href="javascript:history.back(-1)">
        <i class="el-icon-arrow-left"></i>
      </a>
      <a href="javascript:;" class="tc">
        <small class="font_18 co_f">厨房废弃物处理</small>
      </a>
      <a class="operation" v-on:click="show = !show">
        <i class="el-icon-setting"></i> 操作
      </a>
  
      <!--dialog-->
      <transition name="fade">
        <div class="operatbox" v-show="show">
          <router-link :to='{name:"Fqwgllistupdate",query:{
             unid:this.listData[0].unid,
             abandonDate:this.listData[0].abandonDate,
             startHour:this.listData[0].startHour,
             startMin:this.listData[0].startMin,
             endHour:this.listData[0].endHour,
             endMin:this.listData[0].endMin,
             num:this.listData[0].num,
             kind:this.listData[0].kind,
             outTime:this.listData[0].outTime,
             whereabouts:this.listData[0].whereabouts,
             enterprisePerson:this.listData[0].enterprisePerson.name,
             enterprisePersonunid:this.listData[0].enterprisePerson.unid
          }}'>修改</router-link>
          <a @click="handleDelete()">删除</a>
        </div>
      </transition>
    </header>
  
    <main>
      <div class="formcontent">
        <ul>
          <li>
            <span><em>*</em>处置时间</span>
            <div class="froms">
              <label>{{listData[0].outTime|time}}</label>
            </div>
          </li>
           <li>
            <span>处理日期</span>
            <div class="froms">
              <label>{{listData[0].startHour}}时{{listData[0].startMin}}分</label>
            
            </div>
          </li>
          <li>
            <span>种类</span>
            <div class="froms">
              <label>{{listData[0].kind}}</label>
            
            </div>
          </li>
            <li>
            <span>数量</span>
            <div class="froms">
              <label>{{listData[0].num}}</label>
             
            </div>
          </li>
            <li>
            <span>登记日期</span>
            <div class="froms">
              <label>{{listData[0].abandonDate|time}}</label>
            </div>
          </li>
           <li>
            <span>登记时间</span>
            <div class="froms">
              <label>{{listData[0].endHour}}时{{listData[0].endMin}}分</label>
            </div>
          </li>
           <li>
            <span><em>*</em>处置人</span>
            <div class="froms">
              <label>{{listData[0].enterprisePerson.name}}</label>
           
            </div>
          </li>
           <li>
            <span>去向</span>
            <div class="froms">
              <label>{{listData[0].whereabouts}}</label>
            </div>
          </li>
        </ul>
      </div>
    </main>
  </div>
</template>

<script>
  import {AbandonStandingDelete} from '../../api/api';
  import {abandonStanding} from '../../api/api';
  export default {
    data() {
      return {
        listData:[],
        show: false, //默认隐藏
        name:'',
      };
    },
    methods: {
      //数据加载方法   id: this.$route.query.unid,
      getData() {
        //定义需要传给通讯的参数： unid    
       this.PageSize= 1;
        //定义需要传给通讯的参数：QueryData{"PageSize":10,"CurrentPage":1,"Query":{"CriteriaList":[]}}和userunid    
        let varCriteriaList={
            Name: 'Unid',
            Value:this.$route.query.unid,
            Operate: 'Equal',
            DataType: null,
            EndSuffix: '',
            Suffix: null
        }
        let varQueryData = {
          PageSize: this.PageSize,
          CurrentPage: 1,
          Query: {
                 CriteriaList:[],
          }
        }
        varQueryData.Query.CriteriaList.push(varCriteriaList)//往数组里面添加对象
        let options = {
          params: {
            UserUnid: JSON.parse(localStorage.getItem('auth')).UserUnid,
            QueryData: JSON.stringify(varQueryData)
          }
        }
        //调取接口
        abandonStanding(options).then((res) => {
          if (res.success === true) {
            this.listData = res.data;
            console.log(res.data)
          }
        })
      },
      //删除方法
      handleDelete() {
      let deletParams={
         params: {
            unids: this.$route.query.unid,
          }
      }
       this.$confirm('是否删除此条信息?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
      AbandonStandingDelete(deletParams).then(() => {
          this.getData();
          this.$message({
            message: '删除成功',
            type: 'success'
          });
          this.$router.go(-1);
        });
      });
    },

    },
    created() {
      this.getData();
    },
  }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->

<style lang="scss" scoped>
 
</style>
